#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QTextEdit>
#include <QTimer>
#include <QTime>
#include "mylineedit.h"

class MyWidget : public QWidget
{
    Q_OBJECT
public:
    explicit MyWidget(QWidget *parent = 0);
signals:

public slots:
    void advance_time();
    void process_next();
    void process_rst();
    void le_focus_changed( bool);
protected:
    static const int TIMER_PERIOD_MS = 500;
    static const double BLINK_FREQ_BPS = 0.5; // should be less than 500/TIMER_PERIOD_MS
    static const int BOTHER_PERIOD_S = 2;
    static const int DEFAULT_THRESHOLD = 7*60; // in seconds

    bool running;
    double since_lap;
    double total;
    double total_lap;
    int lap_count;
    int threshold;

    enum { LE_WHITE, LE_RED };
    int curr_col;

    QTimer *timer;
    QTime *stime;

    MyLineEdit* p_le;
    QPushButton* p_next;
    QTextEdit* p_text_edit;

    void set_time_ent( const QString& val);
    void read_time_ent();
    void stat_report( const QString& rep_str);
    QString to_time( int t4c);
    QString to_time_w_hours( int t4c);
};

#endif // MYWIDGET_H
